Skip to content

Security: SSRF risk in OpenID discovery fetch#3690

Open
tuanaiseo wants to merge 1 commit intoKinto:mainfrom
tuanaiseo:contribai/fix/security/ssrf-risk-in-openid-discovery-fetch
Open

Security: SSRF risk in OpenID discovery fetch#3690
tuanaiseo wants to merge 1 commit intoKinto:mainfrom
tuanaiseo:contribai/fix/security/ssrf-risk-in-openid-discovery-fetch

Conversation

@tuanaiseo
Copy link
Copy Markdown

Problem

fetch_openid_config() performs requests.get() on a URL derived from untrusted issuer input without host allowlisting, scheme enforcement, or private-address blocking. An attacker could force server-side requests to internal services/metadata endpoints (SSRF).

Severity: high
File: kinto/plugins/openid/utils.py

Solution

Validate and normalize issuer values against a strict allowlist, enforce https only, reject localhost/link-local/private IP ranges after DNS resolution, and consider using a hardened HTTP client policy for outbound identity-provider calls.

Changes

  • kinto/plugins/openid/utils.py (modified)

Testing

  • Existing tests pass
  • Manual review completed
  • No new warnings/errors introduced

`fetch_openid_config()` performs `requests.get()` on a URL derived from untrusted `issuer` input without host allowlisting, scheme enforcement, or private-address blocking. An attacker could force server-side requests to internal services/metadata endpoints (SSRF).

Affected files: utils.py

Signed-off-by: tuanaiseo <221258316+tuanaiseo@users.noreply.github.com>
@leplatrem
Copy link
Copy Markdown
Contributor

This seems useful! thank you :)

Could you please add the appropriate tests to reach full coverage?

@leplatrem
Copy link
Copy Markdown
Contributor

@tuanaiseo ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants